{template "header.html"}

<div class="note note-danger">
    <p>{dr_lang('用于重新统计用户附件的使用大小情况')}</p>
</div>

<div class="row myfbody">
    <div class="col-md-12">

        <div class="portlet light bordered">
            <div class="portlet-title">
                <div class="caption">
                    <span class="caption-subject font-green">{dr_lang('统计附件数据')}</span>
                </div>
            </div>
            <div class="portlet-body form">

                <div class="form-body">

                    <div class="form-group ">
                        <div class="col-md-12 text-center">
                            <a href="javascript:my_update_cache();" class="btn green-meadow">立即更新统计</a>

                        </div>
                        <div class="col-md-12 text-center margin-bottom-30 margin-top-20" id="dr_result">


                        </div>
                    </div>


                </div>
            </div>
        </div>


    </div>

</div>


<script>
    function my_update_cache() {
        var obj = $('#dr_result');
        obj.html("<img style='height:17px' src='/static/assets/images/loading-0.gif' />");

        my_update_attachment(0);


    }
    function my_update_attachment(page) {
        var obj = $('#dr_result');
        $.ajax({
            type: "GET",
            dataType: "json",
            url: "{dr_url(APP_DIR.'/home/update_add')}&page="+page,
            success: function (json) {
                if (json.code == 0) {
                    obj.html('<font color="red">'+json.msg+'</font>');

                } else {
                    if (json.data == 0) {
                        obj.html('<font color="green">'+json.msg+'</font>');
                    } else {
                        my_update_attachment(json.data);
                        obj.html('<font color="blue">'+json.msg+'</font>');
                    }
                }
            },
            error: function(HttpRequest, ajaxOptions, thrownError) {
                obj.html('<font color="red">系统崩溃，请稍后再试</font>');
            }
        });
    }
</script>
{template "footer.html"}